#include <iostream>
#include <string>
#include <stack>
#include <unordered_map>

int main()
{
    std::stack <char> stack;
    std::unordered_map <char, char> brackets = { {')', '('}, {']', '['}, {'}', '{'}, {'>', '<'} };
    std::string sequence;
    std::cout << "Vvedite skobochnuu posledovatelnost: ";
    std::cin >> sequence;

    for (char& ch : sequence) {
        if (brackets.count(ch) && !stack.empty() && stack.top() == brackets[ch]) {
            stack.pop();
        } else if (brackets.find(ch) != brackets.end()) {
            std::cout << "False\n";
            return 0;
        } else {
            stack.push(ch);
        }
    }

    std::cout << (stack.empty() ? "True" : "False") << std::endl;
    return 0;
}
